package com.chat.common.threadLocal;

public class UserContext {
    private static final ThreadLocal<LoginUser> userIdThreadLocal = new ThreadLocal<>();

    public static void setUser(LoginUser user){
        userIdThreadLocal.set(user);
    }
    public static LoginUser getUserId() {
        return userIdThreadLocal.get();
    }
    public static void clear() {
        userIdThreadLocal.remove();
    }
}
